<?php

namespace app\teacher\controller;


use app\admin\model\classes\Student;
use think\Db;
use think\Validate;
use app\admin\model\classes\Classes;
use app\common\model\ClassesSignLog;

class ClassesStudent extends Base
{
    protected $model = null;
    public function __construct(Student $model)
    {
        parent::__construct();
        $this->model = $model;
    }

    public function rand_student()
    {
        $classes_id = $this->request->get('classes_id');
        $total = $this->model->where('classes_id', $classes_id)->count();
        $rand = rand(0, $total-1);
        $student = $this->model->where('classes_id', $classes_id)->limit($rand, 1)->select();
        $this->success('成功', isset($student[0])?$student[0]:[]);
    }

}